
param n;
set PROPERTIES;
# PROPERTIES is a set with the properties that characterize each item.
# In standard Knapsack these are: weight and value. One can think of more 
# such as volume and so on (useful in the so-called multi-Knapsack problems). 

set N := 1..n;
param inputdata{N,PROPERTIES} >= 0;
param MaxCapacity;

var y{N} <=1 >=0; #Variables of the relaxed problem.


maximize Total_Benefit:
sum{i in N} y[i]*inputdata[i,'Benefit'];

subject to Max_Weight:
sum{i in N} y[i]*inputdata[i,'Weight'] <= MaxCapacity;



